from flask import Flask

from flask import render_template

app = Flask(__name__)

@app.route("/book_list/<type>/")
def book_list(type="mulu"):
    bl = [
    {"book_name": "水浒传", "book_type": "小说", "author": "施耐庵", "public":"清华大学出版社"},
    {"book_name": "三国演义", "book_type": "小说", "author": "罗贯中", "public": "清华大学出版社"},
    {"book_name": "红楼梦", "book_type": "小说", "author": "曹雪芹", "public": "清华大学出版社"},
    {"book_name": "西游记", "book_type": "小说", "author": "吴承恩", "public": "清华大学出版社"},
    {"book_name": "雪中悍刀行", "book_type": "小说", "author": "烽火戏诸侯", "public": "清华大学出版社"},
    {"book_name": "海贼王", "book_type": "漫画", "author": "尾田荣一郎", "public": "北京大学出版社"},
    {"book_name": "火影忍者", "book_type": "漫画", "author": "岸本齐史", "public": "北京大学出版社"},
    {"book_name": "灌篮高手", "book_type": "漫画", "author": "井上雄彦", "public": "北京大学出版社"},
    {"book_name": "春物", "book_type": "漫画", "author": "渡航", "public": "北京大学出版社"},
    {"book_name": "鸭子的天空", "book_type": "漫画", "author": "日向武史", "public": "北京大学出版社"},
    {"book_name": "安徒生通话", "book_type": "童话", "author": "安徒生", "public": "人民教育出版社"},
    {"book_name": "伊索寓言", "book_type": "童话", "author": "伊索", "public": "人民教育出版社"},
    {"book_name": "格林童话", "book_type": "童话", "author": "格林", "public": "人民教育出版社"},
    {"book_name": "爱丽丝漫游奇境记", "book_type": "童话", "author": "萧枫", "public": "人民教育出版社"},
    {"book_name": "小王子", "book_type": "童话", "author": "安托万·德·圣·埃克苏佩里", "public": "人民教育出版社"},
    {"book_name": "读者", "book_type": "杂志", "author": "读者", "public": "读者"},
    {"book_name": "儿童文学", "book_type": "杂志", "author": "儿童文学", "public": "儿童文学"},
    {"book_name": "意林", "book_type": "杂志", "author": "意林", "public": "意林"},
    {"book_name": "万物", "book_type": "杂志", "author": "万物", "public": "万物"},
    {"book_name": "博物", "book_type": "杂志", "author": "博物", "public": "博物"},
    {"book_name": "Python全栈开发", "book_type": "教辅工具", "author": "中公教育有就业研究院", "public": "中公教育出版社"},
    {"book_name": "Python核心编程", "book_type": "教辅工具", "author": "中公教育有就业研究院", "public": "中公教育出版社"},
    {"book_name": "Python语言核心编程", "book_type": "教辅工具", "author": "中公教育有就业研究院", "public": "陕西科学技术出版社"},
    {"book_name": "线性代数专项辅导", "book_type": "教辅工具", "author": "中公教育有就业研究院", "public": "中公教育出版社"},
    {"book_name": "微积分的奥秘", "book_type": "教辅工具", "author": "中公教育有就业研究院", "public": "中公教育出版社"},]
    if type == "xiaoshuo":
        bl = [i for i in bl if i["book_type"] == "小说"]
    if type == "jiaofugongjv":
        bl = [i for i in bl if i["book_type"] == "教辅工具"]
    if type == "manhua":
        bl = [i for i in bl if i["book_type"] == "漫画"]
    if type == "tonghua":
        bl = [i for i in bl if i["book_type"] == "童话"]
    if type == "zazhi":
        bl = [i for i in bl if i["book_type"] == "杂志"]
    if type == "quanbu":
        pass
    if type == "mulu":
        return render_template("书籍网站.html",**locals())


    return render_template("书籍.html",**locals())



if __name__=="__main__":
    app.run(
        host="127.0.0.1",
        port=7879,
        debug=True)